window.workspace = function(){
	var response  = <?#$respons?>;
	var store, sm, grid;
	var sid={'nstatus':Ext.id(), 'eid':Ext.id(), 'sdate':Ext.id(), 'edate':Ext.id()};
	store = new Ext.data.JsonStore({
	    autoDestroy	: true,
	    url			: '/admin/workflow/myself/dolist.json',
	    remoteSort	: true,
	    sortInfo	: {
            field		: 'id',
            direction	: 'DESC'
		},
		baseParams	: {
			start	: 0,
			limit	: main.pageSize
		},
		autoLoad		: true,
	    root			: 'dataset',
	 	totalProperty	: 'total',
	    fields			: ['executionid', 'workflowid', 'workflowname', 'stopusername', 'applyusername',
				'remark', 'estatus', 'nodeid', 'name', 'status', 'completetime', 'expire']
	});
	sm   = new Ext.grid.CheckboxSelectionModel({singleSelect:true});
 	grid = {
		xtype		: 'grid',
		title		: response.title,
	    store		: store,
		region		: 'center', 
	    columns		: [
	    	sm,
			{header: '单据ID',width:70,sortable:true,dataIndex:'executionid'},
			{header: '流程ID', width:60, sortable:true,dataIndex:'workflowid'},
			{header: '流程名称', width:120, dataIndex:'workflowname'},
			{header: '单据状态', width:80, dataIndex:'estatus', renderer:function(v){
				return response.estatus[v];
			}},
			{header: '终止操作用户', width:85, dataIndex:'stopusername'},
			{header: '单据申请人', width:100, dataIndex:'applyusername'},
			{header: '节点ID', width:70, dataIndex:'nodeid'},
			{header: '节点名称', width:110, dataIndex:'name'},
			{header: '节点处理状态', width:80, dataIndex:'status', renderer:function(v){
				return response.nstatus[v];
			}},
			{header: '完成时间', width:110, dataIndex:'completetime'},
			{header: '到期时间', width:110, dataIndex:'expire'},
			{header: '备注', width:120, dataIndex:'remark'}
		],
	    viewConfig	: {
	        forceFit	 : true,
	        scrollOffset : 0
	    },
	    sm			: sm,
	    listeners 	:{'rowdblclick':function(grid, index, e){
			var id = grid.store.getAt(index).get('executionid');
	    	var url= '/admin/workflow/executor/id-xxx.html'.replace('xxx', id);
			window.open(url);
		}},
	    stripeRows	: true,
	    tbar		: [{
			text	: '刷新',
			iconCls	: 'icon-refresh',
			handler : function(){
					store.reload(); 
				}
			},'-','<b>检索资料：</b>','单据ID:',{
				xtype       : 'textfield',
				id	    	: sid.eid,
				width	    : 80
			},'节点状态:',{
				xtype		: 'combo',
				store		: new Ext.data.ArrayStore({
			        fields: ['id','name'],
			        data: main.cv2Array(response.nstatus)
			    }),
				displayField	: 'name',
				valueField		: 'id',
				mode			: 'local',
				triggerAction	: 'all',
				emptyText		: '请选择',
				width			: 80,
				id  			: sid.nstatus
			},'接受日期:',{
				xtype       : 'datefield',
				id  		: sid.sdate,
				format		: 'Y-m-d',
				width	    : 100
			},'<->',{
				xtype       : 'datefield',
				id  		: sid.edate,
				format		: 'Y-m-d',
				width	    : 100
			},'-',{
			text			: '检索',
			iconCls			: 'icon-search',
			handler: function() {
				store.baseParams.eid     = Ext.getCmp(sid.eid).getValue();
				store.baseParams.sdate   = Ext.getCmp(sid.sdate).getValue();
				store.baseParams.edate   = Ext.getCmp(sid.edate).getValue();
				store.baseParams.nstatus = Ext.getCmp(sid.nstatus).getValue();
				store.reload(); 
			}
		}],
		bbar		: new Ext.PagingToolbar({
			pageSize	: main.pageSize,
			store		: store,
			displayInfo	: true
		})
	};
	return grid;
}();